package com.tsmti.system.dao.impl;

import com.tsmti.core.common.dao.impl.BaseDaoImpl;
import com.tsmti.system.dao.BillTemplateDao;
import com.tsmti.system.entity.BillTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Package：com.tsmti.system.dao.impl
 * @Class：BillTemplateDaoImpl
 * @Description： TODO
 * @Author：king
 * @Date：Created in 2018/9/28 15:16
 * @Company:
 * @Version：
 * @Modified By:
 */
@Repository("billTemplateDao")
public class BillTemplateDaoImpl extends BaseDaoImpl implements BillTemplateDao{
    /**
     *根据code获取模板
     * @param code
     * @param orgId
     * @return
     */
    @Override
    public BillTemplate getBillTemplateByCode(String code, String orgId) {
        StringBuilder sql = new StringBuilder();
        sql.append(" from BillTemplate where (delFlag is null or delFlag = 0) and code='"+code+"' and orgId='"+orgId+"'");
        List<BillTemplate> list =  getSession().createQuery(sql.toString()).list();
        if(list != null && list.size() > 0){
            return list.get(0);
        }
        return null;
    }
}
